package com.sdx.console.promote.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.promote.dao.PromoteMaterialDao;
import com.sdx.console.promote.entity.PromoteMaterial;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 宣传材料 Service
 */

@Service
@Transactional
public class PromoteMaterialService extends BaseService<PromoteMaterial>{

    @Resource
	private PromoteMaterialDao promoteMaterialDao;

    public PageQuery<PromoteMaterial>queryByCondition(PageQuery query){
        PageQuery ret =  promoteMaterialDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelPromoteMaterial(List<String> ids){
        try {
            promoteMaterialDao.batchDelPromoteMaterialByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除宣传材料失败", e);
        }
    }

	public List<PromoteMaterial> all() {
		return promoteMaterialDao.all();
		}
}